<template>
  <div>
  测试ty版本去重的效果
  </div>
</template>

<script lang="ts">
import Vue from "vue";
import Component from "vue-class-component";

@Component
export default class App extends Vue {
  private tableData: any = [];

  created() {
    let data = [
      { id: 1, name: "obj" },
      { id: 3, name: "string" },
      { id: 2, name: "arr" },
      { id: 1, name: "obj" },
      { id: 3, name: "string" },
      { id: 2, name: "arr" },
      { id: 1, name: "obj" },
      { id: 3, name: "string" },
      { id: 2, name: "arr" },
      { id: 1, name: "num" }
    ];

    let hash = {};

    data = data.reduce(function(arr, current) {
      hash[current.id] ? "" : (hash[current.id] = true && arr.push(current));

      return arr;
    }, []);

    console.log(data, '    00000000000000000000');
  }
}
</script>

<style>
</style>
